package com.lmj.mybatisPlus.controller;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.lmj.mybatisPlus.entry.po.User;
import com.lmj.mybatisPlus.mapper.UserMapper;
import com.lmj.mybatisPlus.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 功能描述:测试部署docker功能
 *
 * @author: 李明杰
 * @date: 2022/1/13 22:17
 */
@RestController
public class UserController {

    @Resource
    UserMapper userMapper;
    @Resource
    UserService userService;

    @GetMapping("/selectUser")
    public List<User> selectUser() {
        ArrayList<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        return userMapper.selectBatchIds(list);
    }

    @GetMapping("/insertUser")
    @DS("mysql-docker")
    public Boolean insert() {
        User user = new User(100, "DynamicDatasource", "DynamicDatasource");
        return userService.save(user);
    }


}
